function ajax(opts){
					const o2s = (obj)=>{
						let keys = Object.keys(obj);
						let values = Object.values(obj);
						return keys.map((key,k)=>`${key}=${values[k]}`).join("&");
					}
					
					let {url="",method="GET",data={},async=true,success=function(){},dataType="text",ContentType=true} = opts;
						// console.log(url,method,data,async);
					let xhr = new XMLHttpRequest();
					// console.log(data);
					// {username:zhangsan,age:20} -----> ?username=zhangsan&age=20
					if(method.toLowerCase()=="get"){
						url = url + "?" + o2s(data);
					}
					
					xhr.open(method,url,async);
					
					if(method.toLowerCase()=="post" && ContentType){
						xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
					}
					
					
					xhr.onload = function(){
						if(dataType=="text"){
							success(xhr.responseText)
						}else{
							success(JSON.parse(xhr.responseText));
						}
					}
					if(method.toLowerCase()=="post"){
						if(ContentType){
							var str = o2s(data);  // name=zhang&age=20
							xhr.send(str);
						}else{
							xhr.send(data);
						}
							
					}else{
						xhr.send();
					}
					
				}